<?php

class Tipos_Ativos_M extends I_Model {

    protected $_table_name = 'tipos_ativos';
    protected $_primary_key = 'ID';
    protected $_primary_filter = 'intval';
    protected $_order_by = 'NAME';
    public $rules = array();
    protected $_timestamps = FALSE;

    
    public  function __construct() {
        parent::__construct();
    }
    
    public  function get_with_categorie($id = null){
    	$method = 'result';
    	  $this->db->select('cat.NAME as CATEGORIA,cat.SLUG as SLUG_CATEGORIA,tp.*')
    	           ->from('tipos_ativos as tp')
    	           ->join('categorias as cat','cat.ID=tp.CATEGORIA_ID');
    	  
    	  if(!is_null($id)){$this->db->where('tp.ID',$id); $method = 'row';}
    	   $q = $this->db->get();
    	   return $q->$method();
    	            
    	
    }
    
    
}
